package cn.iocoder.yudao.module.shop.convert.statistics;

import cn.iocoder.yudao.module.shop.controller.admin.member.vo.MemberUserStatisticsRespVO;
import cn.iocoder.yudao.module.shop.dal.dataobject.statistics.ShopMemberStatisticsDO;
import cn.iocoder.yudao.module.shop.dal.dataobject.statistics.ShopWalletStatisticsDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

@Mapper
public interface ShopStatisticsConvert {

    ShopStatisticsConvert INSTANCE = Mappers.getMapper(ShopStatisticsConvert.class);

    default MemberUserStatisticsRespVO convert(ShopMemberStatisticsDO memberStatisticsDO, ShopWalletStatisticsDO walletStatisticsDO){
        if(memberStatisticsDO == null){
            return null;
        }

        MemberUserStatisticsRespVO respVO = new MemberUserStatisticsRespVO();

        respVO.setTotal(memberStatisticsDO.getTotalCount());
        respVO.setMaleCount(memberStatisticsDO.getMaleCount());
        respVO.setFemaleCount(memberStatisticsDO.getFemaleCount());
        respVO.setRechargeCount(walletStatisticsDO.getTotal());
        respVO.setLeftBalance(walletStatisticsDO.getLeftBalance());

        return respVO;
    }
}
